package test;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.Date;

public class DataHandle2 {

	/**
	 * @param args
	 * @throws Exception 
	 * @throws UnsupportedEncodingException 
	 */
	public static void main(String[] args) throws UnsupportedEncodingException, Exception {
		File f = new File("d:\\tmp\\eds-daemon.log");
		BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f),"utf-8"));
		
		File outFile = new File("d:/tmp/out.csv");
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile),"utf-8"));
		
		String s = br.readLine();

		int totalRow = 0;
		String time1 = null;
		String time2 = null;
		
		String[] t1 = null;
		String[] t2 = null;
		
		int it1 = 0;
		int it2 = 0;
		
		while(s != null ) {
			time1 = s.substring(1, 9);
			s = br.readLine();
			if (s !=null) {
				
			
			time2 = s.substring(1, 9);
			
			t1 = time1.split(":");
			t2 = time2.split(":");
			
			it1 = Integer.parseInt(t1[0]) * 60 * 60 + Integer.parseInt(t1[1]) * 60 + Integer.parseInt(t1[2]);
			
			it2 = Integer.parseInt(t2[0]) * 60 * 60 + Integer.parseInt(t2[1]) * 60 + Integer.parseInt(t2[2]);
			
			//System.out.print(it2 - it1);
			//System.out.println(",");
			
			bw.write((it2 - it1) + " ");
			bw.write("\n");
			
			}
		}
		bw.flush();
		br.close();
		bw.close();

		System.out.println(totalRow);
	}
	

}
